package io.wdb.modules.manager.job.bookshelf;

import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import io.wdb.modules.generator.generator.service.BsHeartbeatLogService;
import io.wdb.modules.manager.gen.manager.WSClientSenderBookShelf;

/**
 * 
 * @ClassName: SchedulingConfig
 * @Description: SpringBoot中定时器的使用，配置十分简单，一个类中可配置多个定时器
 * @author: TOM
 * @Time: 2017年9月19日
 */
@Configuration
@EnableScheduling
public class SchedulingConfig {
	//填充Bean
	private Logger log = org.slf4j.LoggerFactory.getLogger(SchedulingConfig.class);
	
	@Autowired
	private WSClientSenderBookShelf wsClientSenderBookShelf;
	
	@Autowired
	private BsHeartbeatLogService bsHeartbeatLogService;
	
	@Scheduled(cron = "0/30 * * * * ?") // 每30秒执行一次
    public void heartBeat() {
		wsClientSenderBookShelf.wsHeat();
    }
	
	@Scheduled(cron = "10 */5 * * * ?") // 每1分钟执行一次
    public void bookShelfHeartWarn() {
		bsHeartbeatLogService.bookShelfHeartWarn();
    }
	
}
